1 /*
2 
3 Boost Software License - Version 1.0 - August 17th, 2003
4 
5 Permission is hereby granted, free of charge, to any person or organization
6 obtaining a copy of the software and accompanying documentation covered by
7 this license (the "Software") to use, reproduce, display, distribute,
8 execute, and transmit the Software, and to prepare derivative works of the
9 Software, and to permit third-parties to whom the Software is furnished to
10 do so, all subject to the following:
11 
12 The copyright notices in the Software and this entire statement, including
13 the above license grant, this restriction and the following disclaimer,
14 must be included in all copies of the Software, in whole or in part, and
15 all derivative works of the Software, unless such copies or derivative
16 works are solely in the form of machine-executable object code generated by
17 a source language processor.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
22 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
23 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
24 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 DEALINGS IN THE SOFTWARE.
26 
27 */ 
28 
29 module derelict.glib.gutils;
30 
31 import derelict.glib.gtypes;
32 import derelict.glib.glibconfig;
33 import core.stdc.config;
34 import std.c.stdarg;
35 
36 extern (C):
37 
38 alias _Anonymous_0 GUserDirectory;
39 alias _GDebugKey GDebugKey;
40 alias _Anonymous_1 GFormatSizeFlags;
41 alias void function () GVoidFunc;
42 
43 enum _Anonymous_0
44 {
45 	G_USER_DIRECTORY_DESKTOP = 0,
46 	G_USER_DIRECTORY_DOCUMENTS = 1,
47 	G_USER_DIRECTORY_DOWNLOAD = 2,
48 	G_USER_DIRECTORY_MUSIC = 3,
49 	G_USER_DIRECTORY_PICTURES = 4,
50 	G_USER_DIRECTORY_PUBLIC_SHARE = 5,
51 	G_USER_DIRECTORY_TEMPLATES = 6,
52 	G_USER_DIRECTORY_VIDEOS = 7,
53 	G_USER_N_DIRECTORIES = 8
54 }
55 
56 enum _Anonymous_1
57 {
58 	G_FORMAT_SIZE_DEFAULT = 0,
59 	G_FORMAT_SIZE_LONG_FORMAT = 1,
60 	G_FORMAT_SIZE_IEC_UNITS = 2
61 }
62 
63 struct _GDebugKey
64 {
65 	const(gchar)* key;
66 	guint value;
67 }
68 
69 version(Derelict_Link_Static)
70 {
71     extern( C ) nothrow 
72     {
73         const(gchar)* g_get_user_name();
74         const(gchar)* g_get_real_name();
75         const(gchar)* g_get_home_dir();
76         const(gchar)* g_get_tmp_dir();
77         const(gchar)* g_get_host_name();
78         gchar* g_get_prgname();
79         void g_set_prgname(const(gchar)* prgname);
80         const(gchar)* g_get_application_name();
81         void g_set_application_name(const(gchar)* application_name);
82         void g_reload_user_special_dirs_cache();
83         const(gchar)* g_get_user_data_dir();
84         const(gchar)* g_get_user_config_dir();
85         const(gchar)* g_get_user_cache_dir();
86         const(gchar*)* g_get_system_data_dirs();
87         const(gchar*)* g_get_system_config_dirs();
88         const(gchar)* g_get_user_runtime_dir();
89         const(gchar)* g_get_user_special_dir(GUserDirectory directory);
90         guint g_parse_debug_string(const(gchar)* string, const(GDebugKey)* keys, guint nkeys);
91         gint g_snprintf(gchar* string, gulong n, const(gchar)* format, ...);
92         gint g_vsnprintf(gchar* string, gulong n, const(gchar)* format, va_list args);
93         void g_nullify_pointer(gpointer* nullify_location);
94         gchar* g_format_size_full(guint64 size, GFormatSizeFlags flags);
95         gchar* g_format_size(guint64 size);
96         gchar* g_format_size_for_display(goffset size);
97         void g_atexit(GVoidFunc func);
98         gchar* g_find_program_in_path(const(gchar)* program);
99         gint g_bit_nth_lsf(gulong mask, gint nth_bit);
100         gint g_bit_nth_msf(gulong mask, gint nth_bit);
101         guint g_bit_storage(gulong number);
102     }
103 }
104 else
105 {
106     extern( C ) nothrow 
107     {
108         alias da_g_get_user_name = const(gchar)* function();																
109         alias da_g_get_real_name = const(gchar)* function();																
110         alias da_g_get_home_dir = const(gchar)* function();																	
111         alias da_g_get_tmp_dir = const(gchar)* function();																	
112         alias da_g_get_host_name = const(gchar)* function();																
113         alias da_g_get_prgname = gchar* function();																			
114         alias da_g_set_prgname = void function(const(gchar)* prgname);														
115         alias da_g_get_application_name = const(gchar)* function();															
116         alias da_g_set_application_name = void function(const(gchar)* application_name);									
117         alias da_g_reload_user_special_dirs_cache = void function();														
118         alias da_g_get_user_data_dir = const(gchar)* function();															
119         alias da_g_get_user_config_dir = const(gchar)* function();															
120         alias da_g_get_user_cache_dir = const(gchar)* function();															
121         alias da_g_get_system_data_dirs = const(gchar*)* function();														
122         alias da_g_get_system_config_dirs = const(gchar*)* function();														
123         alias da_g_get_user_runtime_dir = const(gchar)* function();															
124         alias da_g_get_user_special_dir = const(gchar)* function(GUserDirectory directory);									
125         alias da_g_parse_debug_string = guint function(const(gchar)* string, const(GDebugKey)* keys, guint nkeys);			
126         alias da_g_snprintf = gint function(gchar* string, gulong n, const(gchar)* format, ...);							
127         alias da_g_vsnprintf = gint function(gchar* string, gulong n, const(gchar)* format, va_list args);					
128         alias da_g_nullify_pointer = void function(gpointer* nullify_location);												
129         alias da_g_format_size_full = gchar* function(guint64 size, GFormatSizeFlags flags);								
130         alias da_g_format_size = gchar* function(guint64 size);																
131         alias da_g_format_size_for_display = gchar* function(goffset size);													
132         alias da_g_atexit = void function(GVoidFunc func);																	
133         alias da_g_find_program_in_path = gchar* function(const(gchar)* program);											
134         alias da_g_bit_nth_lsf = gint function(gulong mask, gint nth_bit);													
135         alias da_g_bit_nth_msf = gint function(gulong mask, gint nth_bit);													
136         alias da_g_bit_storage = guint function(gulong number);		
137     }
138 
139     __gshared
140     {
141         da_g_get_user_name g_get_user_name; 
142         da_g_get_real_name g_get_real_name; 
143         da_g_get_home_dir g_get_home_dir; 
144         da_g_get_tmp_dir g_get_tmp_dir; 
145         da_g_get_host_name g_get_host_name; 
146         da_g_get_prgname g_get_prgname; 
147         da_g_set_prgname g_set_prgname; 
148         da_g_get_application_name g_get_application_name; 
149         da_g_set_application_name g_set_application_name; 
150         da_g_reload_user_special_dirs_cache g_reload_user_special_dirs_cache; 
151         da_g_get_user_data_dir g_get_user_data_dir; 
152         da_g_get_user_config_dir g_get_user_config_dir; 
153         da_g_get_user_cache_dir g_get_user_cache_dir; 
154         da_g_get_system_data_dirs g_get_system_data_dirs; 
155         da_g_get_system_config_dirs g_get_system_config_dirs; 
156         da_g_get_user_runtime_dir g_get_user_runtime_dir; 
157         da_g_get_user_special_dir g_get_user_special_dir; 
158         da_g_parse_debug_string g_parse_debug_string; 
159         da_g_snprintf g_snprintf; 
160         da_g_vsnprintf g_vsnprintf; 
161         da_g_nullify_pointer g_nullify_pointer; 
162         da_g_format_size_full g_format_size_full; 
163         da_g_format_size g_format_size; 
164         da_g_format_size_for_display g_format_size_for_display; 
165         da_g_atexit g_atexit; 
166         da_g_find_program_in_path g_find_program_in_path; 
167         da_g_bit_nth_lsf g_bit_nth_lsf; 
168         da_g_bit_nth_msf g_bit_nth_msf; 
169         da_g_bit_storage g_bit_storage;
170     }
171 }